package lab02.test13;

public class Gymnastics extends ComputerAverage {
    double sum = 0;
    double max;
    double min;

    @Override
    double average(double[] score) {
        max = score[0];
        min = score[0];

        for (int i = 0; i < score.length; i++) {

            if (score[i] > max) {
                max = score[i];
            }

            if (score[i] < min) {
                min = score[i];
            }

            sum += score[i];
        }
        return (sum - min - max) / (score.length - 2);
    }
}
